/*******************************************************
> Copyright (C) 2024 ==IOT== All rights reserved.
> File Name: stl_map.cpp
> Author: IOT
> Website:www.slq.org
> Created Time: 2024年10月30日 星期三 15时32分34秒
***************************************************/

#include <iostream>
#include <map>
using namespace std;

void print_record(map<string,string> &r)
{
	cout << "name " << " | " << "telephone" << endl;
	for (auto it = r.begin(); it != r.end(); ++it) {
		cout << it->first << "," << it->second << endl;
	}
}

class Test
{
	public:
		Test()
		{}
		~Test()
		{
			cout << "" << endl;
		}
};
int main(int argc,const char* argv[])
{
	map<string, string> record;
	
	cout << sizeof(record) << endl;
	cout << record.size() << endl;

	record["zhansan"] = "13872631256";
	record["mike"] = "13872631256";
	record.insert(pair<string,string>("lucy", "13012356701"));

	cout << sizeof(record) << endl;
	cout << record.size() << endl;
	cout << endl;
	print_record(record);	

	//for (const pair<string,string>& y : record) {
	for (auto& y : record) {
		cout << y.first << "," << y.second << endl;
	}

	record.clear();
	cout << sizeof(record) << endl;
	cout << record.size() << endl;

    return 0;
}

